﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DimensionalMeasurement
{
    
        public partial class FormAuxiliaryChart : Form
        {
            string NOrP;
            public FormAuxiliaryChart(string str)
            {
                InitializeComponent();
                NOrP = str;
                if (NOrP == "N")
                {
                    if (PublicSet.Myset.NAuxiliaryChart != "" && PublicSet.Myset.NAuxiliaryChart != null)
                    {
                        pictureBox2.Image = Image.FromFile(PublicSet.Myset.NAuxiliaryChart);

                    }

                }
                else
                {
                    if (PublicSet.Myset.PAuxiliaryChart != "" && PublicSet.Myset.PAuxiliaryChart != null)
                    {
                        pictureBox2.Image = Image.FromFile(PublicSet.Myset.PAuxiliaryChart);
                    }
                }
            }

            private void panel1_MouseDown(object sender, MouseEventArgs e)
            {
                Tool.FormMove(Handle);
            }

            private void bClose_Click(object sender, EventArgs e)
            {
                Close();
            }

            private void bpic_Click(object sender, EventArgs e)
            {
                OpenFileDialog Dlg = new OpenFileDialog();//实例化打开文件对话框的对象
                Dlg.Filter = "(*.bmp;*.png;*.jpg;*.jpeg;*.tif;*.ico)|*.bmp;*.png;*.jpg;*.jpeg;*.tif;*.ico";//打开文件的格式
                                                                                                           //是否允许选择多个文件
                Dlg.Multiselect = false;
                if (Dlg.ShowDialog() == DialogResult.OK)
                {
                    pictureBox2.Image = Image.FromFile(Dlg.FileName);
                    if (NOrP == "N")
                    {
                        PublicSet.Myset.NAuxiliaryChart = Dlg.FileName;
                    }
                    else
                    {
                        PublicSet.Myset.PAuxiliaryChart = Dlg.FileName;
                    }
                }
            }

        }
    
}
